<form class="form" autocomplete="off" novalidate
      #myForm="ngForm"
      [class.submitted]="myForm._submitted"
      (ngSubmit)="save(myForm)">

    <div class="item">
        <label class="required">用户名</label>
        <input type="text" name="name"
               [(ngModel)]="fm.name"
               required />
    </div>

    <div class="item">
        <label class="required">邮箱</label>
        <input type="text" name="email"
               [(ngModel)]="fm.email"
               mVEmail
               required />
    </div>

    <div class="item" *ngIf="adminId">
        <label>密码</label>
        <input type="password" name="password"
               #password="ngModel"
               mReverse_="true"
               mVEquals="__password__"
               [(ngModel)]="fm.password" />
    </div>

    <div class="item" *ngIf="adminId">
        <label>确认密码</label>
        <input type="password"
               name="__password__"
               #__password__="ngModel"
               [(ngModel)]="fm.__password__"
               mReverse_="false"
               mVEquals="password" />
    </div>

    <div class="item" *ngIf="!adminId">
        <label class="required">密码</label>
        <input type="password" name="password"
               #password="ngModel"
               [(ngModel)]="fm.password"
               required />
    </div>

    <div class="item" *ngIf="!adminId">
        <label class="required">确认密码</label>
        <input type="password"
               name="__password__"
               #__password__="ngModel"
               [(ngModel)]="fm.__password__"
               mVEquals="password"
               required />
    </div>

    <div class="actions">
        <button type="submit" class="btn blue">保存</button>
        <button class="btn white" type="button" [routerLink]="['../../']" *ngIf="adminId">取消</button>
        <button class="btn white" type="button" [routerLink]="['../']" *ngIf="!adminId">取消</button>
    </div>
</form>
